package tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;

import toolkit.Debug;
import bean.PizzaBean;

public class PizzaTag extends AbstractTag
{
	PizzaBean pizza;
	String key;
	
	@Override
	public int doStartTag() throws JspException
	{
		String body = (String) pizza.get(key);
		
		try
		{
			pageContext.getOut().print(body);
		}
		catch (IOException e)
		{
			Debug.log(e);
		}
		
		return EVAL_PAGE;
	}

	
	public void setPizza(PizzaBean bean)
	{
		Debug.log("(" + id + ") PizzaTag.setPizza(" + bean + ")");
		
		pizza = bean;
	}
	
	public void setKey(String key)
	{
		Debug.log("(" + id + ") PizzaTag.setValue(" + key + ")");
		
		this.key = key;
	}
}
